package com.ruoyi.bbsAdmin.service.impl;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.uuid.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.bbsAdmin.mapper.OperationRecordMapper;
import com.ruoyi.bbsAdmin.domain.OperationRecord;
import com.ruoyi.bbsAdmin.service.IOperationRecordService;

/**
 * 论坛操作记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-01-26
 */
@Service
public class OperationRecordServiceImpl implements IOperationRecordService 
{
    @Autowired
    private OperationRecordMapper operationRecordMapper;

    /**
     * 查询论坛操作记录
     * 
     * @param id 论坛操作记录主键
     * @return 论坛操作记录
     */
    @Override
    public OperationRecord selectOperationRecordById(String id)
    {
        return operationRecordMapper.selectOperationRecordById(id);
    }

    /**
     * 查询论坛操作记录列表
     * 
     * @param operationRecord 论坛操作记录
     * @return 论坛操作记录
     */
    @Override
    public List<OperationRecord> selectOperationRecordList(OperationRecord operationRecord)
    {
        return operationRecordMapper.selectOperationRecordList(operationRecord);
    }

    /**
     * 新增论坛操作记录
     * 
     * @param operationRecord 论坛操作记录
     * @return 结果
     */
    @Override
    public int insertOperationRecord(OperationRecord operationRecord)
    {
        String newUUID = UUID.randomUUID().toString().replace("-","");
        operationRecord.setId(newUUID);
        operationRecord.setOperateTime(DateUtils.getNowDate());
        operationRecord.setCreateTime(DateUtils.getNowDate());
        operationRecord.setUpdateTime(DateUtils.getNowDate());
        return operationRecordMapper.insertOperationRecord(operationRecord);
    }

    /**
     * 修改论坛操作记录
     * 
     * @param operationRecord 论坛操作记录
     * @return 结果
     */
    @Override
    public int updateOperationRecord(OperationRecord operationRecord)
    {
        operationRecord.setUpdateTime(DateUtils.getNowDate());
        return operationRecordMapper.updateOperationRecord(operationRecord);
    }

    /**
     * 批量删除论坛操作记录
     * 
     * @param ids 需要删除的论坛操作记录主键
     * @return 结果
     */
    @Override
    public int deleteOperationRecordByIds(String[] ids)
    {
        return operationRecordMapper.deleteOperationRecordByIds(ids);
    }

    /**
     * 删除论坛操作记录信息
     * 
     * @param id 论坛操作记录主键
     * @return 结果
     */
    @Override
    public int deleteOperationRecordById(String id)
    {
        return operationRecordMapper.deleteOperationRecordById(id);
    }

    @Override
    public List<OperationRecord> selectBannedList(OperationRecord operationRecord) {
        List<OperationRecord> operationRecordList =new ArrayList<>();
        operationRecord.setBannedTime(new Date());
        operationRecordList =operationRecordMapper.selectBannedList(operationRecord);

        return operationRecordList;
    }
}
